package com.fr.schedule.tables;

import com.fr.data.core.db.dml.Table;
import com.fr.data.core.db.tableObject.AbstractTableObject;
import com.fr.data.core.db.tableObject.Column;
import com.fr.data.core.db.tableObject.ColumnSize;
import com.fr.schedule.task.SAPSynTask;
import com.fr.schedule.util.ScheduleConstants;

import java.sql.Types;

/**
 * @author richie
 * @date 2015-03-12
 * @since 8.0
 */
public class FR_SAP_SYN_TASK extends AbstractTableObject {

    public FR_SAP_SYN_TASK() {
        this.checkTableExistLevel = AbstractTableObject.CHECK_TABLE_EXSIT_ON_TABLENAME;
    }

    public Table getTable() {
        return new Table(SAPSynTask.TABLE_NAME);
    }

    public void initColumns() {
        Column id = new Column(ScheduleConstants.ID, Types.INTEGER, new ColumnSize(20));
        id.setPrimaryKey(true);
        id.setAllowNull(false);
        id.setSelfIncrease(true);
        this.columnsList.add(id);

        Column name = new Column(ScheduleConstants.NAME, Types.VARCHAR, new ColumnSize(255));
        this.columnsList.add(name);

        Column description = new Column(ScheduleConstants.DESCRIPTION, Types.VARCHAR, new ColumnSize(255));
        this.columnsList.add(description);

        Column repeatTime = new Column(ScheduleConstants.REPEAT_TIME, Types.VARCHAR, new ColumnSize(20));
        this.columnsList.add(repeatTime);

        Column repeatTimes = new Column(ScheduleConstants.REPEAT_TIMES, Types.VARCHAR, new ColumnSize(20));
        this.columnsList.add(repeatTimes);

        Column count = new Column(ScheduleConstants.COUNTS, Types.INTEGER, new ColumnSize(5));
        this.columnsList.add(count);

        Column itriggerId = new Column(ScheduleConstants.ITRIGGER_ID, Types.INTEGER, new ColumnSize(20));
        this.columnsList.add(itriggerId);

        Column task_parameters = new Column("task_parameters", Types.VARCHAR, new ColumnSize(255));
        this.columnsList.add(task_parameters);

        Column transfers = new Column("transfers", Types.VARCHAR, new ColumnSize(511));
        this.columnsList.add(transfers);
    }
}